#pragma once

#include "Control.h"

namespace mgui
{
	struct TextFieldEventArgs : public EventArgs
	{
		//std::string TextValue;
		//float FloatValue;
		//int IntValue;
	};

	class TextField : public Control
	{
	public:
		enum Type
		{
			TYPE_TEXT,
			TYPE_FLOAT,
			TYPE_INT
		};

		TextField(const Rect & bounds, Type type);

		static const int EVENT_TEXT_CHANGED = 0;
		
		const std::string & getText() const;
		float getFloat() const;
		int getInt() const;
		
		void setString(const std::string & value);
		void setFloat(float value);
		void setInt(int value);

	private:
		virtual void drawSelf();
		virtual bool processLButtonUpInside(const Point & pt);
		virtual bool processLButtonUpOutside(const Point & pt);
		virtual bool processLButtonDownInside(const Point & pt);
		virtual bool processLButtonDownOutside(const Point & pt);
		virtual bool processMouseMovedInside(const Point & pt);
		virtual bool processMouseMovedOutside(const Point & pt);
		virtual bool processKeyPressed(const input::KeyEvent & key);

		bool processMouseMoved(const Point & pt);

		std::string mText;
		Type mType;

		bool mHasFocus;

		bool mHoldingMouse;
		Point mPrevMousePosition;
	};
}